﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using ComponentFactory.Krypton.Toolkit;
using Microsoft.ApplicationBlocks.Data;
namespace XBYTestManagement
{
    public partial class FrmProductSearch : KryptonForm
    {
        public DataRow resultRow=null;
        public FrmProductSearch()
        {
            InitializeComponent();
        }

        private void FrmProductSearch_Load(object sender, EventArgs e)
        {
            BindProduct();
        }

        private void BindProduct()
        {
            dgv.AutoGenerateColumns = false;
            dgv.Columns.Add("productNumber", "产品编码");
            dgv.Columns[0].DataPropertyName = "Number";
            dgv.Columns.Add("productName", "产品编码");
            dgv.Columns[0].DataPropertyName = "Number";
            dgv.Columns[1].DataPropertyName = "ProductName";
            DataSet ds = OleDbHelper.ExecuteDataset(OleDbHelper.connectionString, CommandType.Text, "select * from product where id not in ( select productID from solution )");
            dgv.DataSource = ds.Tables[0].DefaultView;

        }

        private void dgv_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex == -1) return;
            resultRow = ((DataView)dgv.DataSource).Table.Rows[e.RowIndex];
            this.Close();
        }
    }
}
